﻿
function ContextPickerJs() {

    var _I = this;

    this.Initialize = function (img) {

        _I.Img = $(img);
        _I.IframeDialog = $("#pnlContextPickerFrame");
        _I.IFrame = $('#iframeContextPicker');

        _I.IframeDialog.dialog({
            height: '350',
            autoOpen: false,
            width: '500',
            modal: true,
            closeOnEscape: true,
            beforeClose: function (event, ui) {
                if (!_I.IFrame.get(0).contentWindow.validarGuardar()) {
                    return false;
                }
                else {
                    window.location.reload(true);
                }
            }
        });

        _I.Img.click(function () {
            _I.showDialog();
        });
    }

    this.showDialog = function () {
        _I.IframeDialog.dialog('open');
    };
}